package com.tcl.logoidentify.commons;

import java.io.File;
import java.io.IOException;

import jodd.props.Props;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ConfigUtils {
	private static Props p = null;
	private static final Logger LOGGER = LoggerFactory.getLogger(ConfigUtils.class);
	static {
		p = new Props();
		try {
			String path = Thread.currentThread().getContextClassLoader().getResource("conf.properties").getPath();
			p.load(new File(path));
		} catch (IOException e) {
			LOGGER.error("加载配置文件出错", e);
		}
	}

	public static String $(String key, String defalut) {
		String v = p.getValue(key);
		return v == null ? defalut : v;
	}

	public static String $(String key) {
		return $(key, null);
	}


}
